package com.gears_software.sxdc.dccx.data.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.gears_software.sxdc.dccx.data.model.MyTripModel;
import com.gears_software.sxdc.dccx.data.model.MyTripZCModel;
import com.gears_software.sxdc.dccx.ui.view.MyTripListItemView;
import com.gears_software.sxdc.dccx.ui.view.MyTripListItemView_;
import com.gears_software.sxdc.dccx.ui.view.MyTripZCListItemView;
import com.gears_software.sxdc.dccx.ui.view.MyTripZCListItemView_;

import java.util.List;


/**
 * Created by chezhenzhen on 2017/6/27.
 * 我的行程adapter
 */

public class MyTripZCListAdapter extends BaseAdapter {
    List<MyTripZCModel> list;
    Context context;

    public MyTripZCListAdapter(List<MyTripZCModel> list, Context context) {
        this.list=list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public MyTripZCModel getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyTripZCListItemView itemView;
        if (convertView == null) {
            itemView = MyTripZCListItemView_.build(context);
        } else {
            itemView = (MyTripZCListItemView) convertView;
        }
        itemView.bind(list.get(position));
        return itemView;
    }
}
